﻿using System;
using System.ComponentModel;
using System.Data;
using System.Windows;
using WPFExcelReport.Helpers;

namespace WPFExcelReport
{
    public partial class TAB50PR
    {

        public TAB50PR()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return; 
            InitializeComponent(); 
        }
        public override void OnDESChg(string des)
        {
            base.OnDESChg(des);
            if (DES.Length == 0)
                vwMaster.View.MoveCurrentTo(-1);
            Locate("ABPFARBE", DES); 
        }
        public override void QueryCommand(object sender, RoutedEventArgs e)
        {
            dwData = TBMain.NewRow();
            dwData["ABPMANDANT"] = app.Mandant;
            dwData["ABPAUFKRS"] = KRS;
            dwData["ABPAUFLFD"] = LFD; 
            dwData["ABPPOSTYP"] = "HM ";
            SResult = TMV.QABP48(dwData);
            MergeData(SResult, true);
            base.QueryCommand(sender, e);
        }
        public override void OnEXAUFChg(string vlaue)
        {
            TBMain.Clear();
            KRS = "";
            LFD = "";
            if (EXAUF.Length < 11)
                return;
            KRS = EXAUF.Substring(0, 2);
            LFD = EXAUF.Substring(2, 6);
            QueryCommand(null, null);
            base.OnEXAUFChg(vlaue);
        }
    }
}
